package com.hxd.qzg.interceptor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.servlet.http.HttpServletRequest;

import com.hxd.qzg.common.Result;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;

public class AdminInterceptor implements Interceptor {

	private static final Log logger = LogFactory.get();

	private static final ExecutorService cachedThreadPool = Executors.newFixedThreadPool(5);

	public static final String INCLUDE_SERVLET_PATH_ATTRIBUTE = "javax.servlet.include.servlet_path";

	@Override
	public void intercept(Invocation inv) {

		Controller c = inv.getController();

		HttpServletRequest request = c.getRequest();
		String path = request.getServletPath();
		logger.info("path {} ", path);
		String token = request.getParameter("token");
		logger.info("token {} ", token);

		if (token == null) {
			c.renderJson(Result.failure(800, "验证不通过"));
			return;
		}

		inv.invoke();



	}



}
